﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using diploma.core.GUI;
using diploma.core.data;
using diploma.core.localize;

namespace diploma.test.GUI
{
    public partial class TestForm : DiplomaForm
    {

        public TestForm(Form _parent, AbstractLocalizator _localizator, params DataList<diploma.core.data.IDataObject>[] _dataObjectsCollections)
            : base(_parent, _localizator, _dataObjectsCollections)
        {
            this.testControl = new TestControl(_localizator, dataObjectsCollections);
            this.testControl.Width = this.Width;
            this.testControl.Height = this.Height;
            this.testControl.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Left;
            this.Controls.Add(testControl);
        }

        protected override void fillMainMenuElements()
        {
            base.fillMainMenuElements();
            ToolStripMenuItem _mtesting = new ToolStripMenuItem("menu.testing");
            _mtesting.DropDownItems.Add(new ToolStripMenuItem("menu.testing.open", null, new EventHandler(openForm), "miOpenTestForm"));
            _mtesting.DropDownItems.Add(new ToolStripMenuItem("menu.testing.admin", null, new EventHandler(adminForm), "miAdminTestForm"));
            mainMenuElements.Add(_mtesting);
        }

        private void openForm(object sender, EventArgs e)
        {
            this.Visible = true;
        }

        private void adminForm(object sender, EventArgs e)
        {
            AdminForm adminForm = new AdminForm(localizator, dataObjectsCollections[DataObjectTypes.Question], dataObjectsCollections[DataObjectTypes.Term], dataObjectsCollections[DataObjectTypes.Property], dataObjectsCollections[DataObjectTypes.Theme]);
            adminForm.ShowDialog(parent);
        }

        protected override void fillToolBarElements()
        {
            base.fillToolBarElements();
        }

        protected override void fillStatusBarElements()
        {
            base.fillStatusBarElements();
        }

        public override void Localize()
        {
            this.Text = localizator.GetLocolizeWord(this.Text);
        }
    }
}
